package com.ruoyi.forApp.controller;

import com.ruoyi.forApp.domain.CourseForApp;
import com.ruoyi.forApp.service.ICourseServiceForApp;
import com.ruoyi.framework.web.controller.BaseController;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;



@Controller
public class CourseControllerForApp extends BaseController {
    @Autowired
    private ICourseServiceForApp courseService;

    @PostMapping("/getCourse")
    @ResponseBody
    public Map<String,Object> getCourse(Long userId)
    {
        Map<String,Object> map=new HashMap<>();
        List<CourseForApp> courseForApps=courseService.getCourseList(userId);
        if (courseForApps.size()!=0){
            map.put("success",true);
            map.put("courseList",courseForApps);
        }else {
            map.put("success",false);
            map.put("courseList",null);
        }
        return map;
    }

}
